﻿<%@ Page Title="" Language="C#" MasterPageFile="~/admin/AdminMaster.Master" AutoEventWireup="true" CodeBehind="UpdatePass.aspx.cs" Inherits="ShowRoom.admin.UpdatePass" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<center>
      <div style="width:100%;text-align:center;color:#C794BA;font-weight:bold;margin-bottom:10px;margin-top:15px;"><asp:Label ID="lblTil" runat="server" Text="CẬP NHẬT MẬT KHẨU"></asp:Label></div>       
        <table id="tblMaster" runat="server" bordercolor="#E1E1E1"  border="1" cellpadding="0" cellspacing="0" width="90%"
            style="border-collapse: collapse;">              
            <tr>
                <td style="width: 20%;text-align:right;padding-right:10px;height:30px"  nowrap>
                    Email :</td>
                <td style="width: 80%; text-align: left;padding-left:5px">
                    <asp:TextBox ID="txtEmail" CssClass="cssTextBox" onblur='CheckEmail(this)' Width="150px" runat="server"></asp:TextBox>&nbsp;<asp:Label ID="lblEmailIn" runat="server" ForeColor="Red"></asp:Label></td>
            </tr>  
            <tr>
                <td class="ActDocTD2" style="height: 30px">
                    &nbsp;</td>
                <td style="text-align: left; height: 21px;" align="center" class="ActDocTD3">
                    <asp:Button ID="btnSave" CssClass="button" runat="server" Text="Save" OnClientClick="return fnSave();"
                       onclick="btnSave_Click"  Width="75px" /></td>
            </tr>
        </table>
        </center>
        <script type="text/javascript">
            function CheckEmail(obj) {
                if (document.getElementById("<%= txtEmail.ClientID%>").value != "") {
                    document.getElementById("<%= txtEmail.ClientID%>").className = "cssTextBox";                    
                }
                if (isEmail(obj.value)) {
                    document.getElementById("<%= lblEmailIn.ClientID%>").innerHTML = "";
                } else {
                    document.getElementById("<%= lblEmailIn.ClientID%>").innerHTML = "Email không hợp lệ !";
                    return false;
                }
            }
            function isEmail(email) {
                var isValid = false;
                var regex = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
                if (regex.test(email)) {
                    isValid = true;
                }
                return isValid;
            }

            function fnSave() {
               
                // kiểm tra email
                if (document.getElementById("<%= txtEmail.ClientID%>").value == "") {
                    document.getElementById("<%= txtEmail.ClientID%>").className = "CssNotOk";
                    return false;
                }

                var email = document.getElementById("<%= txtEmail.ClientID%>").value;
                if (isEmail(email)) {
                    document.getElementById("<%= lblEmailIn.ClientID%>").innerHTML = "";
                }
                else {
                    document.getElementById("<%= lblEmailIn.ClientID%>").innerHTML = "Email không hợp lệ";
                    return false;
                }
            }
        </script>
</asp:Content>
